﻿using ERPSystem.Common.DTO;
using MediatR;
using SqlSugar;

namespace SalesManagementWrite.API.SalesManagementWrites.PurchaseInvoicees
{
    public class PurchaseInvoiceCreateCommand:IRequest<Result>
    {
        /// <summary>
        /// 采购发票编号
        /// </summary>
        public int PurchaseInvoiceId { get; set; }
        /// <summary>
        /// 流水号
        /// </summary>
        public string? SerialNumber { get; set; }
        /// <summary>
        /// 单据号
        /// </summary>

        public string? DocumentNo { get; set; }
        /// <summary>
        /// 业务类型
        /// </summary>
        public int BusinessType { get; set; }
        /// <summary>
        /// 供应商
        /// </summary>
        public string? Vendor { get; set; }
        /// <summary>
        /// 开票日期
        /// </summary>

        public DateTime BillingDate { get; set; }
        /// <summary>
        /// 发票上传
        /// </summary>

        public string? OnInvoice { get; set; }
        /// <summary>
        /// 单据日期
        /// </summary>

        public DateTime DocumentDate { get; set; }
        /// <summary>
        /// 操作员
        /// </summary>

        public string? Operator { get; set; }
        /// <summary>
        /// 税号
        /// </summary>

        public string? TaxNo { get; set; }
        /// <summary>
        /// 红字篮字
        /// </summary>
        public string? RedBasketLetter { get; set; }
        /// <summary>
        /// XML格式
        /// </summary>
        public string? XMLFormat { get; set; }
        /// <summary>
        /// 单据状态
        /// </summary>

        public string? DocumentStatus { get; set; }
        /// <summary>
        /// 审核员
        /// </summary>

        public string? Auditors { get; set; }
        /// <summary>
        /// 发票类型
        /// </summary>
        public string? InvoiceTypeId { get; set; }
        /// <summary>
        /// 发票金额
        /// </summary>
        public decimal InvoiceAmount { get; set; }
        /// <summary>
        /// OFD格式
        /// </summary>
        public string? OFPFormat { get; set; }
        /// <summary>
        /// 业务状态
        /// </summary>
        public int BusinessStatusId { get; set; }
        /// <summary>
        /// 发票代码
        /// </summary>

        public string? InvoiceCode { get; set; }
        /// <summary>
        /// 税额
        /// </summary>

        public decimal Tax { get; set; }
        /// <summary>
        /// 发票状态
        /// </summary>

        public string? InvoiceStatus { get; set; }
        /// <summary>
        /// 发票号码
        /// </summary>

        public string? InvoiceNumber { get; set; }
        /// <summary>
        /// 价税合计
        /// </summary>

        public string? PriceTaxTotal { get; set; }
        /// <summary>
        /// 备注信息
        /// </summary>

        public string? RemarkInfo { get; set; }
        public List<PurchaseInvoiceSubtableDto> purchaseInvoiceSubtables { get; set; }

    }
    public class PurchaseInvoiceSubtableDto
    {
        /// <summary>
        /// 采购发票子表编号
        /// </summary>

        public int PurchaseInvoiceSubtableId { get; set; }
        /// <summary>
        /// 采购订单号
        /// </summary>

        public string? PurchaseON { get; set; }
        /// <summary>
        /// 仓库
        /// </summary>

        public string? Warehouse { get; set; }
        /// <summary>
        /// 入库单号
        /// </summary>

        public string? InventoryRN { get; set; }
        /// <summary>
        /// 物流编码
        /// </summary>

        public string? LogisticsCode { get; set; }
        /// <summary>
        /// 物流名称
        /// </summary>

        public string? NameOfLogistics { get; set; }
        /// <summary>
        /// 型号规格
        /// </summary>

        public string? ModelSpecification { get; set; }
        /// <summary>
        /// 主计量
        /// </summary>
        public int MainMetering { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public int Num { get; set; }
        /// <summary>
        /// 单价
        /// </summary>
        public decimal Price { get; set; }
        /// <summary>
        /// 金额
        /// </summary>
        public decimal Amount { get; set; }
        /// <summary>
        /// 税率
        /// </summary>
        public decimal TaxRate { get; set; }
        /// <summary>
        /// 税额
        /// </summary>
        public decimal AmountOfTax { get; set; }
        /// <summary>
        /// 流水号
        /// </summary>
        public string? SerialNumber { get; set; }
    }
}
